#include <QDebug>
#include "settingsdialog.h"
#include "ui_settingsdialog.h"

SettingsDialog::SettingsDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingsDialog)
{
    ui->setupUi(this);
    connect(this, SIGNAL(accepted()), this, SLOT(onAccepted()));

    settings.beginGroup("Interface");
    ui->interfaceNotifications->setChecked(settings.value("Notifications", true).toBool());
    settings.endGroup();
}

SettingsDialog::~SettingsDialog()
{
    delete ui;
}

void SettingsDialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void SettingsDialog::onAccepted()
{
    settings.beginGroup("Interface");
    settings.setValue("Notifications", ui->interfaceNotifications->isChecked());
    settings.endGroup();
}
